/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



// gallery fade
var count = 4;
var currentid = "";
var myTimer;
var next;
function ChangeImage(which){
    $clear(myTimer);
    if (currentid != "") {
        $('image' + currentid).fade('out');
        //$('link' + currentid).parentNode.parentNode.setStyle('background-color', '#c99710');
        $('link' + currentid).getParent('li').setStyle('background-color', '#c99710');
    }
    $('image' + which).fade('in');
    //$('link' + which).parentNode.parentNode.setStyle('background-color', '#be7116');
    $('link' + which).getParent('li').setStyle('background-color', '#be7116');
    currentid = which;
    if (currentid < count) {
        next = currentid + 1;
    }
    else {
        next = 1;
    }
    myTimer = (function(){
        ChangeImage(next);
    }).delay(10000);
};
window.addEvent("domready",function(){
    for (f = 1; f <= count; f++) {
        $('image' + f).fade('hide');
    }
    ChangeImage(1);
});
